package com.caimiao.miao.library.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {

    public static String getNowTime() {
        return getCurrentDateFormat("yyyy-MM-dd HH:mm:ss");
    }

    public static String getTimestamp() {
        return getCurrentDateFormat("yyyyMMddHHmmssSSS");
    }

    public static String getCurrentDateFormat(String format) {
        try {
            SimpleDateFormat sdf = new SimpleDateFormat(format);
            return sdf.format(new Date(System.currentTimeMillis()));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
